class Feedback < ActiveRecord::Base
  belongs_to :user
  has_many :votes
  
  validates_presence_of :title
  
  def mark_done
    self.done = true
    save

    self.votes.each do |v|
      v.destroy
    end
  end
  
  def voted_on?(user)
    return (Vote.find(:first, :conditions=>{:user_id => user.id, :feedback_id => id}) != nil)
  end
end
